﻿<Window x:Class="BackupGUI.TaskSettings"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Backup="clr-namespace:Backup"
    xmlns:wpftoolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
    xmlns:ValueConverter="clr-namespace:Backup.ValueConverter" 
    Title="Aufgabe anpassen" Width="450" SizeToContent="Height" ResizeMode="NoResize"
        Background="{DynamicResource ResourceKey=WindowBackground}">
    <StackPanel>
        <StackPanel.Resources>
            <ValueConverter:List2String x:Key="List2String"/>
        </StackPanel.Resources>
        <DockPanel>
            <Label DockPanel.Dock="Left">Quellpfad</Label>
            <Button DataContext="txtSource" DockPanel.Dock="Right" MinWidth="25" Click="Button_Click" Name="btnSelectSource">...</Button>
            <TextBox Text="{Binding SourceRoot, UpdateSourceTrigger=Explicit}" Name="txtSource" TextChanged="txtSource_TextChanged" />
        </DockPanel>
        <DockPanel>
            <Label DockPanel.Dock="Left">Zielpfad</Label>
            <Button DataContext="txtTarget" DockPanel.Dock="Right" MinWidth="25" Name="btnSelectTarget" Click="Button_Click">...</Button>
            <TextBox Text="{Binding TargetRoot, UpdateSourceTrigger=Explicit}" Name="txtTarget" />
        </DockPanel>
        <DockPanel>
            <Label DockPanel.Dock="Left">Ausschluss</Label>
            <TextBox Text="{Binding Excludes, UpdateSourceTrigger=Explicit, Converter={StaticResource List2String}}" Name="txtExclude"/>
        </DockPanel>
        <DockPanel>
            <Label DockPanel.Dock="Left">Enthält</Label>
            <TextBox Text="{Binding Includes, UpdateSourceTrigger=Explicit, Converter={StaticResource List2String}}" Name="txtInclude"/>
        </DockPanel>
        <DockPanel>
            <Label DockPanel.Dock="Left">Optionen</Label>
            <StackPanel Background="Transparent">
                <CheckBox Name="chkFullBackup" IsChecked="{Binding FullBackup, UpdateSourceTrigger=Explicit}">Vollständige Sicherung</CheckBox>
                <CheckBox IsChecked="{Binding Recursive, UpdateSourceTrigger=Explicit}" Name="chkRecursive">Unterverzeichnisse einbeziehen</CheckBox>
                <CheckBox IsChecked="{Binding ExcludeHidden, UpdateSourceTrigger=Explicit}" Name="chkHidden">Systemdateien ausschließen</CheckBox>
                <CheckBox IsChecked="{Binding ExcludeSystem, UpdateSourceTrigger=Explicit}" Name="chkSystem">Versteckte Dateien ausschließen</CheckBox>
                <CheckBox IsChecked="{Binding CopyACL, UpdateSourceTrigger=Explicit}" Name="chkACL">Zugriffsrechte übernehmen</CheckBox>
                <CheckBox IsChecked="{Binding CopyADS, UpdateSourceTrigger=Explicit}" Name="chkADS">Erweiterte Datenströme kopieren</CheckBox>
            </StackPanel>
        </DockPanel>
        <DockPanel>
            <DockPanel.Resources>
                <Style TargetType="{x:Type StackPanel}">
                    <Style.Setters>
                        <Setter Property="Background" Value="Transparent"/>
                    </Style.Setters>
                </Style>
                <Style TargetType="{x:Type Button}">
                    <Style.Setters>
                        <Setter Property="Margin" Value="0"/>
                        <Setter Property="MinHeight" Value="0"/>
                        <Setter Property="MinWidth" Value="0"/>
                    </Style.Setters>
                </Style>
                <Style TargetType="{x:Type wpftoolkit:DatePicker}">
                    <Style.Setters>
                        <Setter Property="BorderBrush" Value="{x:Null}"/>
                        <Setter Property="BorderThickness" Value="0"/>
                        <Setter Property="Background" Value="White"/>
                    </Style.Setters>
                </Style>
                <ValueConverter:Bool2Visibility x:Key="boolToVis"/>
                <ValueConverter:Date2Bool x:Key="Date2Bool"/>
            </DockPanel.Resources>
            <Label DockPanel.Dock="Left">Einschränkungen</Label>
            <StackPanel>
                <CheckBox Name="chkCreated">
                    <CheckBox.Content>Erstelldatum einschränken</CheckBox.Content>
                    <CheckBox.IsChecked>
                        <MultiBinding Converter="{StaticResource Date2Bool}" UpdateSourceTrigger="Explicit">
                            <Binding Path="MinCreated" />
                            <Binding Path="MaxCreated" />
                        </MultiBinding>
                    </CheckBox.IsChecked>
                </CheckBox>
                <StackPanel Orientation="Horizontal" Margin="20,0,0,0" Visibility="{Binding Path=IsChecked, ElementName=chkCreated, Converter={StaticResource boolToVis}}">
                    <Label Style="{x:Null}">Von </Label>
                    <wpftoolkit:DatePicker Name="createdFrom" SelectedDate="{Binding MinCreated, UpdateSourceTrigger=Explicit}"/>
                    <Label Style="{x:Null}">Bis </Label>
                    <wpftoolkit:DatePicker Name="createdTo" SelectedDate="{Binding MaxCreated, UpdateSourceTrigger=Explicit}"/>
                </StackPanel>
                <CheckBox Name="chkModified">
                    <CheckBox.Content>Änderungsdatum einschränken</CheckBox.Content>
                    <CheckBox.IsChecked>
                        <MultiBinding Converter="{StaticResource Date2Bool}" UpdateSourceTrigger="Explicit">
                            <Binding Path="MinChanged" />
                            <Binding Path="MaxChanged" />
                        </MultiBinding>
                    </CheckBox.IsChecked>
                </CheckBox>
                <StackPanel Orientation="Horizontal" Margin="20,0,0,0" Visibility="{Binding Path=IsChecked, ElementName=chkModified, Converter={StaticResource boolToVis}}">
                    <Label Style="{x:Null}">Von</Label>
                    <wpftoolkit:DatePicker Name="modifiedFrom" SelectedDate="{Binding MinChanged, UpdateSourceTrigger=Explicit}"/>
                    <Label Style="{x:Null}">Bis</Label>
                    <wpftoolkit:DatePicker Name="modifiedTo" SelectedDate="{Binding MaxChanged, UpdateSourceTrigger=Explicit}"/>
                </StackPanel>
                <CheckBox Name="chkSize">
                    <CheckBox.Content>Dateigröße einschränken</CheckBox.Content>
                    <CheckBox.IsChecked>
                        <MultiBinding Converter="{StaticResource Date2Bool}" UpdateSourceTrigger="Explicit">
                            <Binding Path="MinSize" />
                            <Binding Path="MaxSize" />
                        </MultiBinding>
                    </CheckBox.IsChecked>
                </CheckBox>
                <StackPanel Orientation="Horizontal" Margin="20,0,0,0" Visibility="{Binding Path=IsChecked, ElementName=chkSize, Converter={StaticResource boolToVis}}">
                    <Label Style="{x:Null}">Von</Label>
                    <TextBox Style="{x:Null}" Width="50" Name="txtMinSize" Text="{Binding MinSize, UpdateSourceTrigger=Explicit}"/>
                    <Label Style="{x:Null}">Bis</Label>
                    <TextBox Style="{x:Null}" Width="50" Name="txtMaxSize" Text="{Binding MaxSize, UpdateSourceTrigger=Explicit}"/>
                </StackPanel>
            </StackPanel>
        </DockPanel>
        <StackPanel Background="{DynamicResource ResourceKey=PanelBackground}">
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
            <Button HorizontalAlignment="Center" IsDefault="True" Name="btnOK" Click="btnOK_Click">OK</Button>
            <Button HorizontalAlignment="Center" IsCancel="True" Name="btnCancel" Click="btnCancel_Click">Abbrechen</Button>
        </StackPanel>
        </StackPanel>
    </StackPanel>
</Window>
